<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .active{
            color: red;
        }
    </style>
</head>
<body>

    <div id="app">
        <!-- <h2 :class="active">{{message}}</h2>
        <h2>{{message}}</h2> -->
        <!-- <h2 v-bind:class="{类名1:true,类名2:boolean}">{{message}}</h2> -->

        <!-- <h2 v-bind:class="{active:true,line:false}">{{message}}</h2> -->
        <h2 class="tittle" v-bind:class="{active:isActive,line:isLine}">{{message}}</h2>
        <h2 class="tittle" v-bind:class="getClasses()">{{message}}</h2>
        <button @click="click">按钮</button>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        const app = new Vue({
            el:'#app',
            data:{
                message:'你好呀！',
               isActive:true,
               isLine:true
            },
            methods:{
                click(){
                    this.isActive = !this.isActive
                },
                getClasses:function(){
                    return {active:this.isActive,line:this.isLine}
                }
            }
        })
    </script>
</body>
</html>